package com.cms.controller;

import com.cms.entity.Schedule;
import com.cms.model.Result;
import com.cms.service.ScheduleService;
import com.cms.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(path = "/schedule")
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;

    @ResponseBody
    @RequestMapping (path = "/findAll", method = RequestMethod.GET)
    public Result findAll() {
        List<Schedule> scheduleList = scheduleService.findAll();
        return ResultUtil.success(scheduleList.size(), scheduleList);
    }
}
